{include file="header.htm" /}
<style>
    .title-1{font-size: 14px;margin: 5px 0;font-weight: bold;background: #F7F7F7;padding:5px 10px;}
    .type-file-box span.error{
        position: absolute;left: 380px;word-wrap: break-word;width: 300px;}
</style>
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <form class="form-horizontal" id="post_form" action="{:weapp_url('AirBottle/AirBottle/add')}" method="post">
        <div class="ncap-form-default">
            <div class="title-1">钢瓶基本信息</div>
            <dl class="row">
                <dt class="tit">
                    <label for="title"><em>*</em>产品标题</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[title]" placeholder="请输入产品标题" value="" id="title" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="type"><em>*</em>型号类型</label>
                </dt>
                <dd class="opt">
                    <select name="row[type]" id="type">
                        <option value="154" selected>154</option>
                        <option value="300">300</option>
                        <option value="370">370</option>
                    </select>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="xinghao"><em>*</em>产品型号</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[xinghao]" placeholder="请输入产品型号" value="" id="xinghao" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="code"><em>*</em>钢瓶编号</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[code]" placeholder="请输入钢瓶编号" value="" id="code" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label for="licence">制造生产许可证</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[licence]" placeholder="请输入制造生产许可证" id="licence" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="maf_date">生产日期</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[maf_date]" placeholder="请输入生产日期" id="maf_date" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="dielectric">充装介质</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[dielectric]" placeholder="请输入充装介质" id="dielectric" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="zd_czl">最大充装量(kg)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[zd_czl]" placeholder="请输入最大充装量" id="zd_czl" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="gfzd_czl">干粉最大充装量(kg)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[gfzd_czl]" placeholder="请输入干粉最大充装量" id="gfzd_czl" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="cx_czl">超细干粉最大充装量(kg)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[cx_czl]" placeholder="请输入超细干粉最大充装量" id="cx_czl" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="weight">钢瓶总重量(kg)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[weight]" placeholder="请输入钢瓶总重量" id="weight" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="cailiao">瓶体材料</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[cailiao]" placeholder="请输入钢瓶总重量" id="cailiao" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label for="capacity">公称容积(L)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[capacity]" placeholder="请输入公称容积" id="capacity" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="pt_hd">瓶体设计厚度（mm）</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[pt_hd]" placeholder="请输入瓶体设计厚度" id="pt_hd" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="bihou">名义壁厚(mm)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[bihou]" placeholder="请输入名义壁厚" id="bihou" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="neijing">钢瓶内径(mm)</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[neijing]" placeholder="请输入钢瓶内径" id="neijing" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="wendu">工作温度℃</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[wendu]" placeholder="请输入工作温度℃" id="wendu" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="sy">水压试验压力Pa</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[sy]" placeholder="请输入水压试验压力Pa" id="sy" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="qy">气密性试验压力Pa</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[qy]" placeholder="请输入气密性试验压力Pa" id="qy" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="rcl">热处理方式</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[rcl]" placeholder="请输入热处理方式" id="rcl" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="pressure">公称工作压力MPa</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[pressure]" placeholder="请输入公称工作压力" id="pressure" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="luowen">瓶口螺纹</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[luowen]" placeholder="请输入瓶口螺纹" id="luowen" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-300">
                <dt class="tit">
                    <label for="sjyl">设计压力MPa</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[sjyl]" placeholder="请输入设计压力" id="sjyl" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">排序</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[sort_order]" value="100" id="sort_order" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">越小越靠前</p>
                </dd>
            </dl>
            <div class="title-1 show-154">阀门信息</div>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="fm_factory">阀门厂家</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="row[fm_factory]" placeholder="请输入阀门厂家" id="fm_factory" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row show-154">
                <dt class="tit">
                    <label for="fm_cert">阀门证书</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_6" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_6" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="fm_cert" name="row[fm_cert]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button6" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back6')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <div class="title-1">证书信息</div>
            <dl class="row">
                <dt class="tit">
                    <label for="certificate_img">合格证</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_1" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_1" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="certificate_img" name="row[certificate_img]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="certificate_img">质量证明书</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_2" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_2" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="quality_cert_img" name="row[quality_cert_img]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button2" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back2')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="certificate_img">监督检验证书</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_3" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_3" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="testing_cert_img" name="row[testing_cert_img]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button3" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back3')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="certificate_img">型式试验证书</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_4" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_4" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="ce_cert_img" name="row[ce_cert_img]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button4" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back4')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">

                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="code_img">钢瓶编码</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show div_logo_local">
                        <span class="show">
                            <a id="img_a_5" class="nyroModal" rel="gal" href="javascript:void(0);"  onmouseout="layer.close(layer_tips);" target="_blank">
                                <i id="img_i_5" class="fa fa-picture-o"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="code_img" name="row[code_img]" value="" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button5" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back5')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">

                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>


            <div class="bot">
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/plugins/laydate/laydate.js"></script>
<script src="__WEAPP_TEMPLATE__/skin/js/jquery.validate.min.js"></script>
<script type="text/javascript">
    var start = {
        elem: '#maf_date',//选择ID为START的input
        event:'click',
        format: 'YYYY-MM-DD',//自动生成的时间格式
    };
    laydate(start);

    var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引

    $("#type").change(function () {
        if($(this).val()==154){
            $(".show-154").show();
            $(".show-300").hide();
        }else{
            $(".show-154").hide();
            $(".show-300").show();
        }
    });
    $(function () {
        if($("#type").val()==154){
            $(".show-154").show();
            $(".show-300").hide();
        }else{
            $(".show-154").hide();
            $(".show-300").show();
        }

        //表单数据校验
        $("#post_form").validate({
            ignore: ":hidden:not(select)",//解决无法校验select
            errorElement: "span",
            rules: {
                'row[code]':"required",
                'row[title]':"required",

            },
            messages: {
                'row[code]':"气瓶编号不能为空",
                'row[title]':"产品标题不能为空",
            }
        });

    });
    // 判断输入框是否为空
    function checkForm(){
        if($("#post_form").valid()){
            layer_loading('正在处理');
            $.ajax({
                type : 'post',
                url : "{:weapp_url('AirBottle/AirBottle/add', ['_ajax'=>1])}",
                data : $('#post_form').serialize(),
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.code == 1){
                        var _parent = parent;
                        _parent.layer.close(parentObj);
                        _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                            _parent.window.location.reload();
                        });
                    }else{
                        showErrorMsg(res.msg);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        }

    }
    
    function img_call_back(fileurl_tmp)
    {
        $("#certificate_img").val(fileurl_tmp);
        $("#img_a_1").attr('href', fileurl_tmp);
        $("#img_i_1").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
    function img_call_back2(fileurl_tmp)
    {
        $("#quality_cert_img").val(fileurl_tmp);
        $("#img_a_2").attr('href', fileurl_tmp);
        $("#img_i_2").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
    function img_call_back3(fileurl_tmp)
    {
        $("#testing_cert_img").val(fileurl_tmp);
        $("#img_a_3").attr('href', fileurl_tmp);
        $("#img_i_3").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
    function img_call_back4(fileurl_tmp)
    {
        $("#ce_cert_img").val(fileurl_tmp);
        $("#img_a_4").attr('href', fileurl_tmp);
        $("#img_i_4").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
    function img_call_back5(fileurl_tmp)
    {
        $("#code_img").val(fileurl_tmp);
        $("#img_a_5").attr('href', fileurl_tmp);
        $("#img_i_5").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
    function img_call_back6(fileurl_tmp)
    {
        $("#fm_cert").val(fileurl_tmp);
        $("#img_a_6").attr('href', fileurl_tmp);
        $("#img_i_6").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
</script>
{include file="footer.htm" /}